//服务器全部接口返回的数据类型
export interface ResponseData{
    code: number,
    message: string,
    ok: boolean,
}
//SPU数据的ts类型
export interface SpuData{
    id?:number|string,
    spuName: string,
    description: string,
    category3Id: string|number,
    tmId: number|string,
    spuSaleAttrList:null|SaleAttr[],
    spuImageList:null|SpuImg[],
}
//数组：元素都是已有SPU数据的类型
export type Recodes=SpuData[];
//定义获取已有的SPU接口返回的数据ts类型
export interface HasSpuResponseData extends ResponseData{
    data: {
        records: Recodes,
        total: number,
        size: number,
        current: number,
        searchCount: boolean,
        pages: number,
    }
}

//所有品牌数据的ts类型
export interface Trademark{
    id: number,
    tmName:string,
    logoUrl: string,
}
//品牌接口返回的数据ts类型
export interface AllTradeMark extends ResponseData{
    data: Trademark[],
}

//商品图片ts类型
export interface SpuImg{
    id?: number,
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    imgName?: string,
    imgUrl?: string,
    name?: string,
    url?: string,
}

//图片数据类型
export interface SpuHasImg extends ResponseData{
    data: SpuImg[],
}


//销售属性类型
export interface SaleAttrValue{
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number,
    saleAttrValueName: string,
    saleAttrName?: string,
    isChecked?: null,
}
//存储已有的销售属性值数组类型
export type spuSaleAttrValueList=SaleAttrValue[];
//销售属性对象类型
export interface SaleAttr{
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: string,
    baseSaleAttrId: number,
    saleAttrName: string,
    spuSaleAttrValueList: spuSaleAttrValueList,
    flag?: boolean,
    saleAttrValue?: string,
}
//SPU销售属性接口返回数据ts类型
export interface SaleAttrResponseData extends ResponseData{
    data:SaleAttr[]
}


//已有的全部的SPU返回数据类型
export interface HasSaleAttr{
    id: number,
    name:string,   
}
export interface HasSaleAttrResponseDate extends ResponseData{
    data: HasSaleAttr[]
}

export interface Attr{
    
    attrId: number|string,
    valueId: number|string,
    
}


export interface saleAttr{
    
    saleAttrId: number|string,
    saleAttrValueId: number|string,
    
}


export interface SkuData{
    category3Id: string | number //三级分类的ID
    spuId: string | number //已有的SPU的ID
    tmId: string | number //SPU品牌的ID
    skuName: string //sku名字
    price: string | number //sku价格
    weight: string | number //sku重量
    skuDesc: string //sku的描述
    skuAttrValueList?: Attr[],
    skuSaleAttrValueList?: saleAttr[],
    skuDefaultImg: string //sku图片地址
}

//获取SKU数据接口的ts类型
export interface SkuInfoData extends ResponseData{
    data: SkuData[],
}
